<template>
	<view>
		<u-sticky bgColor="#6492FF" offsetTop=0 customNavHeight=0>
			<navbox title="报备信息"></navbox>
		</u-sticky>
		<view class="con" v-if="list.length>0">
			<view class="con__box" v-for="(item,index) in list" :key="index" @click="clickzk(index)">
				<view class="u-flex u-flex-y-center u-flex-between" :style="{marginBottom: item.zk?'46rpx':'0',}">
					<view class="u-flex u-flex-y-center">
						<image :src="prologo" class="con__box__pic" mode=""></image>
						<view class="con__box__title">
							{{item.zk?item.product:item.name}}
						</view>
					</view>
					<view class="con__box__right u-flex u-flex-y-center">
						<view class="con__box__item__value" v-if="item.status==0">
							待审核
						</view>
						<view class="con__box__item__value" v-if="item.status==2">
							失败
						</view>
						<view class="con__box__item__value" v-if="item.status==1">
							通过
						</view>
						<view class="" style="margin-left: 5rpx;">
							
							<u-icon v-if="item.zk" name="arrow-up-fill" size="18rpx"></u-icon>
							<u-icon v-else name="arrow-down-fill" size="18rpx"></u-icon>
						</view>
					</view>
				</view>
				<view class="" v-if="item.zk">
					<view class="con__box__item">
						<view class="con__box__item__label">
							报备时间：
						</view>
						<view class="con__box__item__value">
							{{item.buildTime}}
						</view>
					</view>
					<view class="con__box__item">
						<view class="con__box__item__label">
							推广员：
						</view>
						<view class="con__box__item__value">
							{{item.name}}
						</view>
					</view>
					<view class="con__box__item" v-if="item.thirdId" @click.stop="copy(item.thirdId)">
						<view class="con__box__item__label">
							推广员ID：
						</view>
						<view class="con__box__item__value">
							{{item.thirdId}}
						</view>
					</view>
					<view class="con__box__item">
						<view class="con__box__item__label">
							手机号：
						</view>
						<view class="con__box__item__value">
							{{item.tel}}
						</view>
					</view>
					<view class="con__box__item" v-if="item.area">
						<view class="con__box__item__label">
							作业地区：
						</view>
						<view class="con__box__item__value">
							{{item.area}}
						</view>
					</view>
					<view class="con__box__item" v-for="(item1,index1) in item.extendlist">
						<view class="con__box__item__label">
							{{item1.name}}：
						</view>
						<view class="con__box__item__value">
							{{item1.val}}
						</view>
					</view>
					<view class="con__box__item">
						<view class="con__box__item__label">
							审核状态：
						</view>
						<view class="con__box__item__value" v-if="item.status==0">
							待审核
						</view>
						<view class="con__box__item__value" v-if="item.status==2">
							失败
						</view>
						<view class="con__box__item__value" v-if="item.status==1">
							通过
						</view>
					</view>
					<view class="con__box__item" v-if="item.extend1">
						<view class="con__box__item__label">
							失败原因：
						</view>
						<view class="con__box__item__value">
							{{item.extend1}}
						</view>
					</view>
					<view class="con__box__item" v-if="item.qrcode">
						<view class="con__box__item__label">
							推广码：
						</view>
						<image :src="item.qrcode" @click.stop="imgPreview([item.qrcode])" class="con__box__item__qr" mode="widthFix"></image>
					</view>
					<view class="con__box__ms">
						查看产品详情页
					</view>
					<view class="con__box__ms">
						获取推广码
					</view>
					<view class="con__box__footer">
						<u-button text="查看推广流程"
							@click="navto('/pages/home/proinfo?title='+item.product+'&id='+item.productId)" color="#6492FF"
							shape='circle'></u-button>
					</view>
				</view>
			</view>
		</view>
		<view class="" v-else style="margin-top: 200rpx;">
			<u-empty icon="/static/img/index/empty.png" mode="data" text="暂时没有数据"></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		ownApplyList,
		product
	} from '@/api/home.js'
	export default {
		data() {
			return {
				list: [],
				prologo:''
			};
		},
		onLoad(option) {
			ownApplyList({
				productId: option.productId
			}).then(res => {
				if (res.data.code == 200) {
					this.list = res.data.data
					this.list.map(t => {
						t.extendlist = JSON.parse(t.extend)
						t.zk = false
					})
					console.log(this.list)
					product(option.productId).then(res1 => {
						if (res1.data.code == 200) {
							this.prologo=res1.data.data.logo
						}
					})

				}
			})
		},
		methods:{
			clickzk(index){
				this.list[index].zk=!this.list[index].zk
				this.$forceUpdate()
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.con {
		padding: 25rpx 16rpx;

		&__box {
			padding: 22rpx 42rpx 22rpx 46rpx;
			background: #FFFFFF;
			border-radius: 14rpx;
			margin-bottom: 25rpx;

			&__title {
				font-family: Source Han Sans SC;
				font-weight: bold;
				font-size: 33rpx;
				color: #3E3D3D;
				line-height: 33rpx;
			}

			&__pic {
				width: 104rpx;
				height: 104rpx;
				margin-right: 30rpx;
				border-radius: 20rpx;
			}

			&__item {
				line-height: 25rpx;
				display: flex;
				justify-content: space-between;
				margin-bottom: 40rpx;

				&__label {
					font-family: Source Han Sans SC;
					font-weight: 400;
					font-size: 26rpx;
					color: #3E3D3D;
				}

				&__value {
					font-family: Source Han Sans SC;
					font-weight: 400;
					font-size: 26rpx;
					color: #707070;
				}

				&__qr {
					width: 187.5rpx;

				}
			}

			&__ms {
				display: flex;
				justify-content: center;
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 25rpx;
				color: #707070;
				line-height: 25rpx;
				margin-bottom: 24rpx;
			}

			&__footer {
				padding: 0 52rpx;
			}
		}
	}
</style>